﻿using CommunityToolkit.Mvvm.ComponentModel;
using CommunityToolkit.Mvvm.Input;

namespace TotalApplication.Core
{
    public partial class RegisterViewModel : BaseViewModel
    {
        #region public properties

        [ObservableProperty]
        private string? _email;

        [ObservableProperty]
        private bool _isUpdating;

        #endregion

        #region private properties


        #endregion

        #region commands

        [RelayCommand]
        private async Task Register(object parameter)
        {
            await RunCommand(() => IsUpdating, async () =>
            {
                await Task.Delay(2000); // Simulate a register delay

                var email = Email;
                var pass = ((IHavePassword)parameter).Password.Unsecure();
            });

        }


        [RelayCommand]
        private async Task Login()
        {
            IoC.Application.GoToPage(ApplicationPage.Login);

            await Task.Delay(1);
        }
        #endregion


    }
}
